<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/vue/2.6.14/vue.js" type="application/javascript"></script>
</head>
<body>
    <div id="app">
        <!-- .enter不能用于父子通信，用于冒泡原生事件 -->
        <!-- <el-input @keyup.enter="onKeyup"></el-input> -->

        <!-- 法一：通过事件冒泡起作用 -->
        <!-- <div @keyup.enter="onKeyup">
            <el-input></el-input>
        </div> -->
        <!-- 法二：加上.native修饰符起作用 -->
        <el-input @keyup.enter.native="onKeyup"></el-input>
    </div>
</body>
<script >
    Vue.component('el-input', {
        template: `<input>
        </input>`
    })
    new Vue({
        el: '#app',
        data() {
            return {
                msg: 'hello vue'
            }
        },
        methods: {
            onKeyup(){
                console.log('键盘抬起')
            }
        },
    })
</script>
</html>
